<?php

namespace app\common\model\mysql;

use think\Model;

class SOrderRefundGoods extends Model
{
    /**
     * 查询售后订单商品数据列表
     * @param $where
     * @param $field
     * @param $limit
     * @param $page
     * @return \think\Paginator
     * @throws \think\db\exception\DbException
     */
    public function getNormalOrderRefundGoodsList($orderRefundId, $field){
        $where = [
            ['order_refund_id','=',$orderRefundId]
        ];
        $order = [
            "a.order_refund_goods_id" =>"asc",
        ];
        $result = $this->alias('a')->join('s_order_goods b', 'a.order_goods_id = b.order_goods_id')->where($where)->field($field)->order($order)->select();
        return $result->toArray();
    }

    //批量插入售后订单与售后订单商品关联表数据
    public function insertAllOrderRefundGoods($orderRefundGoodsData){
        if(empty($orderRefundGoodsData)){
            return false;
        }
        return $this->insertAll($orderRefundGoodsData);
    }
}
